<template>
    <el-radio-group
        v-model="currentTab"
        @change="handleChange"
    >
        <el-radio-button label="testA">
            组件A
        </el-radio-button>
        <el-radio-button label="testB">
            组件B
        </el-radio-button>
    </el-radio-group>
    <component :is="current" />
</template>

<script setup>
import { ref } from 'vue'
import TestA from './test/TestA.vue'
import TestB from './test/TestB.vue'

const MAP = {
    testA: TestA,
    testB: TestB
}
let current = ref(TestA)
let currentTab = ref('testA')

function handleChange(val) {
    current.value = MAP[val]
}
</script>